function ToggleClass(element,classOne, classTwo, event) {
    event.cancelBubble = true;

    var classes = element.className.split(" ");
    var firstIndex = classes.indexOf(classOne);
    var secondIndex = classes.indexOf(classTwo);

    if ( firstIndex != -1) {
        classes[firstIndex] = classTwo;
    } else {
        classes[secondIndex] = classOne
    }
    element.className = classes.join(" ");
}

function ToggleClassHandler(event) {
    ToggleClass(this,"collasped","expanded",(event == null)? window.event : event);
}

function SetupMenuTree(elementId) {
    var tree = document.getElementById(elementId);
    var treeElements = tree.getElementsByTagName("li");

    for ( var i=0; i < treeElements.length; i++ ) {
        if ( treeElements[i].getElementsByTagName("ul").length > 0 ) {
            treeElements[i].onmouseover = ToggleClassHandler;
            treeElements[i].onmouseout = ToggleClassHandler;
        }
    }
}